package cn.itsource.hrm;

import cn.itsource.hrm.document.CourseDoc;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class CreateElasticsearch {
    @Autowired
    private ElasticsearchTemplate template;

    // 创建索引库 和映射关系
    @Test
    public void createIndex(){
        //创建索引库
        template.createIndex(CourseDoc.class);
        // 创建映射关系
        template.putMapping(CourseDoc.class);
    }

}
